<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%String path = request.getContextPath(); %>
<jsp:include page="/manage/inc/head.jsp"></jsp:include>
<jsp:include page="/manage/inc/menu.jsp"></jsp:include>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>
            	<a href="/jscss/admin/design/">首页</a>
            		<span class="crumb-step">&gt;</span>
            			<a class="crumb-name" href="<%=path%>/AdminServlet?action=getAllAdmins">管理员管理</a>
            				<span class="crumb-step">&gt;</span><span>添加管理员</span>
            </div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<%=path %>/AdminServlet?action=addAdmin" method="post" id="myform" name="myform" >
                    <table class="insert-tab" width="100%">
                        <tbody>
                       
                            <tr>
                                <th><i class="require-red">*</i>账号：</th>
                                <td>
                                    <input class="common-text required" id="account" name="account" size="50" value="" type="text">
                                    <span id="sp" style="color:red;"></span>
                                </td>
                            </tr> 
                            <tr>
                                <th><i class="require-red">*</i>密码：</th>
                                <td>
                                    <input class="common-text required" id="password" name="password" size="50" value="" type="text">
                                    <span id="sp2" style="color:red;"></span>
                                </td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input class="btn btn-primary btn6 mr10" id="sub" value="提交" type="button">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
    <jsp:include page="/manage/inc/foot.jsp"></jsp:include>
    <script>
    //判断分类名称不能为空
    $(function(){
    	$("#sub").click(function(){
    		var account=$("#account").val();
    		var password=$("#password").val();
    		if(account==""){
    			$("#sp").html("不能为空！");
    			$("#title").select();
    			return;
    		}else{
    			$("#sp").html("");
    		}
    		
    		if(password==""){
    			$("#sp2").html("不能为空！");
    			$("#password").select();
    			return;
    		}else{
    			$("#sp2").html("");
    		}
    			
    			$.ajax({
    				url:"<%=path %>/AdminServlet?action=accountRepeat",
    				data:{account:account},
    				success:function(mes){
    					if(mes=="ok"){
    						$("#myform").submit();
    						$("#sp").html("");
    					}else{
    						$("#sp").html("账号名重复");
    					}
    				}
    			});
    		
    	})
    });
    </script>